package com.dfbz.demo01;

import java.io.File;
import java.io.FileFilter;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo06_FileFilter_基本用法 {
    public static void main(String[] args) {

        File file = new File("D:\\000");


       /* File[] files = file.listFiles(new FileFilter() {
            @Override
            public boolean accept(File pathname) {
                return pathname.getName().endsWith(".zip");
            }
        });*/



         File[] files = file.listFiles((filename)->{
             return filename.getName().endsWith(".zip");
         });


        for (File tempFile : files) {
            System.out.println(tempFile);
        }

    }
}

class MyFileFilter implements FileFilter{
    @Override
    public boolean accept(File pathname) {
        return pathname.getName().endsWith(".zip");
    }
}
